package com.spring.mapper;

import com.spring.pojo.User;
import org.mybatis.spring.SqlSessionTemplate;

import java.util.List;

/**
 * @author:liuwei
 * @creatdate:2021-07-19-11:15
 */
public class UserMapperImpl implements UserMapper{
	//之前使用sqlSession来执行，现在使用sqlSessionTemplate;
	private SqlSessionTemplate sqlSession;

	public void setSqlSession(SqlSessionTemplate sqlSession) {
		this.sqlSession = sqlSession;
	}

	@Override
	public List<User> selectUser() {
		UserMapper mapper = sqlSession.getMapper(UserMapper.class);
		List<User> users = mapper.selectUser();
		return users;
	}
}
